<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<link rel="stylesheet" href="../../jquery-easyui-1.3.6/themes/default/easyui.css" type="text/css"></link>
    <link rel="stylesheet" href="../../css/icons/icon.css" type="text/css"></link>
	<link rel="stylesheet" type="text/css" href="../demo.css"></link>
	<script type="text/javascript" src="../../jquery-easyui-1.3.6/jquery.min.js"></script>
    <script type="text/javascript" src="../../jquery-easyui-1.3.6/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../../jquery-easyui-1.3.6/locale/easyui-lang-zh_CN.js"charset="utf-8"></script>
	<script type="text/javascript" src="../../Exteasyui/datetimebox.js"></script>
    <script type="text/javascript" src="../../Exteasyui/datagrid-detailview.js"></script>
	<script type="text/javascript" src="../../Exteasyui/onCollapse.js" charset="utf-8"></script>
	<script type="text/javascript"> 
    function qq(value,name){ 
     alert(value+":"+name) 
    } 
    </script>
	<script type="text/javascript">
    //清空表单查询条件
		function clearform(){
			$('#name').form('clear');
		}
	</script>
	
<script type="application/javascript">//json封装  
$.fn.serializeObject = function()    
{    
   var o = {};    
   var a = this.serializeArray();    
   $.each(a, function() {    
       if (o[this.name]) {    
           if (!o[this.name].push) {    
               o[this.name] = [o[this.name]];    
           }    
           o[this.name].push(this.value || '');    
       } else {    
           o[this.name] = this.value || '';    
       }    
   });    
   return o;    
};    
function onClik(){  
        //var data = $("#form1").serializeArray(); //自动将form表单封装成json提交  
        //alert(JSON.stringify(data));  
        var jsonuserinfo = $('#form1').serializeObject();
        alert(JSON.stringify(jsonuserinfo));  
}
function onClik6(){  
        //var data = $("#form6").serializeArray(); //自动将form表单封装成json提交  
        //alert(JSON.stringify(data));  
        var jsonuserinfo = $('#form6').serializeObject();
        alert(JSON.stringify(jsonuserinfo));  
}  
</script>

<script type="text/javascript">
	//单选按钮选中后双击取消选中
	window.onload = function() {
		// setRadio("myDiv", "form1", "alreadySelected"); 
		var radios = document.getElementsByTagName("input");
		for ( var i = 0; i < radios.length; i++) {
			if (radios[i].type == "radio") {
				radios[i].ondblclick = function() {
					this.checked = false;
				}
			}
		}
	}
</script>

<script type="text/javascript">
    //清空拖卡表单
		function clearForm6(){
			$('#form6').form('clear');
		}
	</script>
	
</head>
<body>
<div class="easyui-layout" fit="true" border="false">
	<div region="north" border="false" title="查询" iconCls="icon-search"
		style="height:85px;overflow:hidden;">
		<form id="name" name="name" method="post" action="">
			<table class="tableForm datagrid-toolbar"
				style="width:100%;height:100%;">
				<tr>
				<th>车辆状态</th>
				<td><input id="ss" class="easyui-searchbox" style="width:321px" data-options="searcher:qq,prompt:'请选择或输入查询条件',menu:'#mm'"></input>
				<div id="mm" style="width:150px"> 
                <div data-options="name:'all',iconCls:'icon-ok'">全部</div> 
                <div data-options="name:'已完成'">已完成</div>
                <div data-options="name:'已装货'">已装货</div>
                <div data-options="name:'已发出'">已发出</div>
                <div data-options="name:'已卸货'">已卸货</div>
                </div>
				</td>
				</tr>
				<tr>
					<th>出车时间</th>
					<td><input name="createdatetimeStart"
						class="easyui-datetimebox" editable="false" style="width:155px;" />至<input
						name="createdatetimeEnd" class="easyui-datetimebox"
						editable="false" style="width:155px;" /> <a
						href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-search"
						onclick="cd.user.search();">查询</a> <a href="javascript:void(0);"
						class="easyui-linkbutton" iconCls="icon-undo" onclick="clearform()">清空</a></td>
				</tr>
			</table>
		</form>
	</div>
	<div region="center" title="状态列表" border="false" style="width:1200px;overflow:hidden">
		<table id="dg" border="false" style="width:1270px;height:455px;overflow:hidden"
           data-options="
           url:'status6.json' ,
           method:'get',
           title:'',
           singleSelect:true,
           fitColumns:true,
           rowStyler: function(index,row){
					if (row.status!='已完成'){
						return 'background-color:#6293BB;color:#fff;font-weight:bold;';
					}
				}
           ">
        <thead>
            <tr>
                <th field="doc_no" width="100">托单号</th>
                <th field="client" width="120">客户</th>
                <th field="type"  width="80">业务类型</th>
                <th field="no"  width="100">车牌号</th>
                <th field="driver"  width="100">司机</th>
                <th field="drive_time"  width="100">出车时间</th>
                <th field="status" width="120" align="center">运输状态</th>
				<th field="operate" width="120" align="center" data-options="formatter:operate">托单操作</th>
            </tr>
        </thead>
    </table>
	</div>
</div>
<div id="w" class="easyui-window" title="普货托单详情" border="false" data-options="iconCls:'icon-formedit',minimizable:false,closable:true,closed:true,zIndex:100000000000000,inline:false" style="width:900px;" >
	
	<div class="easyui-panel" title="" style="width:1100px">
		<div style="padding:10px 0 10px 10px">
	    <form id="form6" name="form6" method="post" action="">
	    	<table>
	    		<tr>
	    			<td align="right">选择客户</td>
	    			<td><input id="client" value="DHY|大红鹰车队" class="easyui-combobox" name="client" data-options="valueField:'client_code',textField:'client_name',url:'get_client.json'" /></td>
	    		</tr>
	    		<tr>
	    			<td align="right">立方</td>
	    			<td><textarea id="cube" class="easyui-numberbox" name="cube" data-options="min:0,precision:1" suffix=" M³" style="width:129px;height:20px;">12</textarea></td>
				    <td align="right">吨位</td>
	    			<td><textarea id="ton" class="easyui-numberbox" name="ton" data-options="min:0,precision:1" suffix=" T" style="height:20px;">4</textarea></td>
	    		</tr>
	    		<tr>
	    			<td align="right">装货时间</td>
					<td><input id="load_date" value="2014-04-15 08:30:00" class="easyui-datetimebox" name="load_date" /></td>
					<td align="right">装货地址</td>
					<td><textarea id="load_addr" name="load_addr"  style="height:20px">鄞州区江南路</textarea></td>
					<td align="right">装货联系人电话</td>
					<td><textarea id="load_tel" class="easyui-numberbox" name="load_tel"  style="height:20px">15232654859</textarea></td>
				</td>
	    		</tr>
	    		<tr>
	    			<td align="right">收货时间</td>
					<td><input id="receive_date" value="2014-04-16 08:30:00" class="easyui-datetimebox" name="receive_date" /></td>
					<td align="right">收货地址</td>
					<td><textarea id="receive_addr" name="receive_addr"  style="height:20px">江东区百丈路</textarea></td>
					<td align="right">收货联系人电话</td>
					<td><textarea id="receive_tel" class="easyui-numberbox" name="receive_tel"  style="height:20px">18798214563</textarea></td>
				</td>
	    		</tr>
				<tr>
	    			<td align="right">送货方式</td>
					<td><input id="deliver_type" name="deliver_type" type="radio" value="自提" />自提<input id="deliver_type" name="deliver_type" type="radio" value="送货上门" />送货上门</td>
					<td align="right">回单情况</td>
					<td><input id="recovery" name="recovery" type="radio" value="未签回" />未签回<input id="recovery" name="recovery" type="radio" value="已签回" />已签回</td>
					<td align="right">回单签收要求</td>
					<td><input id="sign" type="checkbox" name="sign" value="签托运单回执" />签托运单回执<input id="sign" type="checkbox" name="sign" value="签客户送货单回执" />签客户送货单回执<input id="sign" type="checkbox" name="sign" value="收货人必须盖章" />收货人必须盖章&nbsp;&nbsp;其他<textarea id="sign" name="sign"  style="width:90px;height:20px"></textarea></td>
	    		</tr>
				<tr>
				    <td align="right">运费</td>
					<td><textarea id="transport_cost" class="easyui-numberbox" name="transport_cost"  style="width:129px;height:20px;" prefix="￥" data-options="min:0,precision:2"></textarea></td>
					<td align="right">直送费</td>
					<td><textarea id="direct_cost" class="easyui-numberbox" name="direct_cost"  style="height:20px;" prefix="￥" data-options="min:0,precision:2"></textarea></td>
	    			<td align="right">提货费</td>
					<td><textarea id="lading_cost" class="easyui-numberbox" name="lading_cost"  style="height:20px;" prefix="￥" data-options="min:0,precision:2"></textarea></td>
			    </tr>
				<tr>
					<td align="right">垫付费</td>
					<td><textarea id="advance_cost" class="easyui-numberbox" name="advance_cost"  style="width:129px;height:20px;" prefix="￥" data-options="min:0,precision:2"></textarea></td>
	    			<td align="right">付款方式</td>
					<td><input id="pay_type" name="pay_type" type="radio" value="现付" />现付<input id="pay_type" name="pay_type" type="radio" value="欠款" />欠款<input id="pay_type" name="pay_type" type="radio" value="提货付款">提货付款</td>
				</tr>
				<tr>
				    <td align="right">代收运费金额</td>
					<td><textarea id="replace_transport_cost" class="easyui-numberbox" name="replace_transport_cost"  style="width:129px;height:20px;" prefix="￥" data-options="min:0,precision:2"></textarea></td>
					<td align="right">代收货款金额</td>
					<td><textarea id="replace_direct_cost" class="easyui-numberbox" name="replace_direct_cost"  style="height:20px;" prefix="￥" data-options="min:0,precision:2"></textarea></td>
	    			<td align="right">附发票号</td>
					<td><textarea id="invoice_no" class="easyui-numberbox" name="invoice_no"  style="height:20px;" data-options="min:0"></textarea></td>
			    </tr>
				<tr>
					<td align="right">中转费</td>
					<td><textarea id="transit_cost" class="easyui-numberbox" name="transit_cost"  style="width:129px;height:20px;" prefix="￥" data-options="min:0,precision:2"></textarea></td>
					<td align="right"><input id="replace_type" name="replace_type" type="radio" value="先直送后收货" />先直送后收货</td>
					<td align="right"><input id="replace_type" name="replace_type" type="radio" value="先收款后送货" />先收款后送货&nbsp;&nbsp;&nbsp;&nbsp;<input id="replace_type" name="replace_type" type="radio" value="自送">自送</td>
				    <td align="right"><input id="replace_type" name="replace_type" type="radio" value="上门提货">上门提货&nbsp;&nbsp;&nbsp;&nbsp;其他</td>
					<td align="left"><textarea id="replace_type" name="replace_type"  style="height:20px"></textarea></td>
				</tr>
	    		<tr>
				    <td align="right">拖卡费</td>
					<td><textarea id="cost" class="easyui-numberbox" name="cost"  style="width:129px;height:20px;" prefix="￥" data-options="min:0,precision:2"></textarea></td>
					<td align="right">结算期限</td>
	    			<td><select id="deadline" class="easyui-combobox" name="deadline" style="width:150px;"><option value=""></option><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option></select></td>
	    		</tr>
				<tr><td><br/><br/><td></tr>
				
				<tr>
				    <td align="right">销售人员</td>
					<td><input id="sale" value="市场部|王五" class="easyui-combobox" name="sale" data-options="valueField:'staff_code',textField:'cname',url:'employee.json'" /></td>
					<td align="right">销售备注</td>
					<td><textarea id="sale_remark" name="sale_remark" >已确认按时收货</textarea></td>
				</tr>
	    	</table>
	    </form>
	    </div>
	    <div style="text-align:center;padding:10px">
	    	<a onclick="onClik6();" href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-ok'">提交</a>
	    	<a onclick="clearForm6()" href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-undo'">重置</a>
	    </div>
	</div>
	
	</div>
    <script type="text/javascript">
        $(function(){
            $('#dg').datagrid({
                pagination : true,//进度条
			    pageSize : 10,//每页显示10条
			    pageList : [ 10, 20, 30, 40, 50 ],//选择每页显示条数
				fit:true,
				border:false,
				striped : true,
                view: detailview,
                detailFormatter:function(index,row){
                    return '<div style="padding:2px"><table class="ddv"></table></div>';
                },
                onExpandRow: function(index,row){
                    var ddv = $(this).datagrid('getRowDetail',index).find('table.ddv');
                    ddv.datagrid({
                        url:'status_collapse.json?itemid='+row.itemid,
                        fitColumns:true,
                        singleSelect:true,
                        rownumbers:true,
                        loadMsg:'',
                        height:'auto',
                        columns:[[
                            {field:'time',title:'时间',width:100,
                            editor : {
					                 type : 'datetimebox',
					                 options : {
						             required : true
					                 }
				             }},
                            {field:'now_status',title:'车辆状态',width:120},
                            {field:'comment',title:'备注',width:120}
                        ]],
                        onResize:function(){
                            $('#dg').datagrid('fixDetailRowHeight',index);
                        },
                        onLoadSuccess:function(){
                            setTimeout(function(){
                                $('#dg').datagrid('fixDetailRowHeight',index);
                            },0);
                        }
                    });
                    $('#dg').datagrid('fixDetailRowHeight',index);
                }
            });
        });

    </script>
<script type="text/javascript">
 function constructionManager(){
$('#w').window('open')}
function  operate(val,row){
return '<a href="javascript:void(0)" onclick="constructionManager(\'' + row.id+ '\')">托单操作</a>  '}
 </script>
</body>
</html>